﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class Form3 : Form
    {
        public Form3()
        {
            InitializeComponent();
        }
        //信息框
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
           
        
        }

        private void Form3_Load(object sender, EventArgs e)
        {

            string strsql = "server =PC-202001311751\\MYSQLSERVER; uid =yun0823;pwd =jxy130452;database =WinformText";
            SqlConnection sqlConnection = new SqlConnection(strsql);
            SqlCommand sqlCommand = new SqlCommand();
            string codString = "select * from course";
            SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(codString, sqlConnection);
            DataTable dataTable = new DataTable();
            sqlConnection.Open();
            sqlDataAdapter.Fill(dataTable);
            dataGridView1.DataSource = dataTable;


        }
    }
}
